/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

/**
 *
 * @author
 * Abraão de Santana
 * Jorge Thiago
 * Leandro C. Arantes
 */
public class JanelaEscalonador extends javax.swing.JFrame {

    /** Creates new form JanelaEscalonador */
    public JanelaEscalonador() {
        initComponents();
    }

    //Lista o processo que está sendo executado no processador especificado
    public void setIdProcessoAtivo(int numProcessador, String idProcesso) {

        switch (numProcessador) {
            case 1: {
                lbNumProcessP1.setText("Processo nº: " + idProcesso);
                break;
            }
            case 2: {
                lbNumProcessP2.setText("Processo nº: " + idProcesso);
                break;
            }
            case 3: {
                lbNumProcessP3.setText("Processo nº: " + idProcesso);
                break;
            }
            case 4: {
                lbNumProcessP4.setText("Processo nº: " + idProcesso);
                break;
            }
        }
    }

    //Métodos para modificar os estados dos recursos do sistema
    //boolean livre = true -> recurso está disponível no sistema
    //boolean livre = false -> recurso não está disponível no sistema. O ícone será modificado
    public void setImpressora1(boolean livre) {
        lbImpressora1.setEnabled(livre);
    }

    public void setImpressora2(boolean livre) {
        lbImpressora2.setEnabled(livre);
    }

    public void setScanner(boolean livre) {
        lbScanner.setEnabled(livre);
    }

    public void setModem(boolean livre) {
        lbModem.setEnabled(livre);
    }

    public void setDriveCD1(boolean livre) {
        lbDriveCD1.setEnabled(livre);
    }

    public void setDriveCD2(boolean livre) {
        lbDriveCD2.setEnabled(livre);
    }

    //Métodos de acesso ao temporizador
    public void setTemporizador() {
        temporizador.setText(Integer.toString(Integer.parseInt(temporizador.getText()) + 1));
    }

    public int getTemporizador() {
        return Integer.parseInt(temporizador.getText());
    }

    /************************* Métodos de inserção ****************************/
    //Método que insere um processo na fila de entrada
    public void insereProcessoFE(String processo) {
        filaEntrada.setText(filaEntrada.getText() + "\n" + "(" + processo + ")");
    } //Testar!

    //Método que insere o identificador do processo na fila de tempo-real
    public void insereProcessoFTR(int idProcessoTR) {
        if (filaTempoReal.getText() == null) //VERIFICAR se a condição não gera uma exceção!!!
        {
            filaTempoReal.setText(Integer.toString(idProcessoTR));
        } else {
            filaTempoReal.setText(filaTempoReal.getText() + ", " + Integer.toString(idProcessoTR));
        }
    }

    //Método que insere o identificador do processo na fila de usuário 1
    public void insereProcessoFU1(int idProcessoU1) {
        if (filaUsuario1.getText() == null) {
            filaUsuario1.setText(Integer.toString(idProcessoU1));
        } else {
            filaUsuario1.setText(filaUsuario1.getText() + ", " + Integer.toString(idProcessoU1));
        }
    }

    //Método que insere o identificador do processo na fila de usuário 2
    public void insereProcessoFU2(int idProcessoU2) {
        if (filaUsuario2.getText() == null) {
            filaUsuario2.setText(Integer.toString(idProcessoU2));
        } else {
            filaUsuario2.setText(filaUsuario2.getText() + ", " + Integer.toString(idProcessoU2));
        }
    }

    //Método que insere o identificador do processo na fila de usuário 3
    public void insereProcessoFU3(int idProcessoU3) {
        if (filaUsuario3.getText() == null) {
            filaUsuario3.setText(Integer.toString(idProcessoU3));
        } else {
            filaUsuario3.setText(filaUsuario3.getText() + ", " + Integer.toString(idProcessoU3));
        }
    }

    /************************** Métodos de remoção ****************************/
    //Método que remove o identificador do processo da fila de tempo-real
    public void removeProcessoFTR() {
        String aux = filaTempoReal.getText();
        String aux2 = "";
        if (!aux.isEmpty()) {
            String[] lista = aux.split(", ");
            for (int i = 1; i < lista.length; i++) {
                aux2 = aux2 + lista[i];
            }
        }
        filaTempoReal.setText(aux2);
    }//GAMBIARRA!!!!! Será que funciona???

    //Método que escreve o tamanho de um bloco na respectiva MP
    public void insereBlocoMP (int numeroMP, int tamanho){
        if (numeroMP == 1){
            mp1.setText(mp1.getText() + "\n" + "_________________________" + "\n" + Integer.toString(tamanho) + "\n");
        }
        else 
            mp2.setText(mp2.getText() + "\n" + "_________________________" + "\n" + Integer.toString(tamanho) + "\n");
    }
    
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        painelPrincipal = new javax.swing.JPanel();
        painelCPUMP1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        mp1 = new javax.swing.JTextPane();
        lbMP1 = new javax.swing.JLabel();
        painelP1 = new javax.swing.JPanel();
        lbLogoP1 = new javax.swing.JLabel();
        lbP1 = new javax.swing.JLabel();
        lbNumProcessP1 = new javax.swing.JLabel();
        painelP2 = new javax.swing.JPanel();
        lbLogoP2 = new javax.swing.JLabel();
        lbP2 = new javax.swing.JLabel();
        lbNumProcessP2 = new javax.swing.JLabel();
        painelCPUMP2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        mp2 = new javax.swing.JTextPane();
        lbMP2 = new javax.swing.JLabel();
        painelP3 = new javax.swing.JPanel();
        lbLogoP3 = new javax.swing.JLabel();
        lbP3 = new javax.swing.JLabel();
        lbNumProcessP3 = new javax.swing.JLabel();
        painelP4 = new javax.swing.JPanel();
        lbLogoP4 = new javax.swing.JLabel();
        lbP4 = new javax.swing.JLabel();
        lbNumProcessP4 = new javax.swing.JLabel();
        bCancelar = new javax.swing.JButton();
        bExecutar = new javax.swing.JButton();
        bPausa = new javax.swing.JButton();
        painelRecursos = new javax.swing.JPanel();
        lbImpressora1 = new javax.swing.JLabel();
        lbImpressora2 = new javax.swing.JLabel();
        lbScanner = new javax.swing.JLabel();
        lbModem = new javax.swing.JLabel();
        lbDriveCD1 = new javax.swing.JLabel();
        lbDriveCD2 = new javax.swing.JLabel();
        painelFilas = new javax.swing.JPanel();
        filaTempoReal = new javax.swing.JTextField();
        filaUsuario1 = new javax.swing.JTextField();
        filaUsuario2 = new javax.swing.JTextField();
        filaUsuario3 = new javax.swing.JTextField();
        lbTempoReal = new javax.swing.JLabel();
        lbUsuario1 = new javax.swing.JLabel();
        lbUsuario2 = new javax.swing.JLabel();
        lbUsuario3 = new javax.swing.JLabel();
        painelFilaEntrada = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        filaEntrada = new javax.swing.JTextPane();
        painelContador = new javax.swing.JPanel();
        temporizador = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Escalonador de Processos - Sistemas Operacionais");
        setResizable(false);

        painelCPUMP1.setBorder(javax.swing.BorderFactory.createTitledBorder("Conjunto 1"));

        mp1.setEditable(false);
        jScrollPane1.setViewportView(mp1);

        lbMP1.setFont(new java.awt.Font("Tahoma", 1, 11));
        lbMP1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/mp_32x32.png"))); // NOI18N
        lbMP1.setText("MP1");

        painelP1.setBackground(new java.awt.Color(102, 102, 102));
        painelP1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 5, true));
        painelP1.setMaximumSize(new java.awt.Dimension(100, 100));

        lbLogoP1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/CPU2_64x64.png"))); // NOI18N

        lbP1.setFont(new java.awt.Font("Tahoma", 1, 13));
        lbP1.setText("P1");

        lbNumProcessP1.setText("Processo n°: ---");

        javax.swing.GroupLayout painelP1Layout = new javax.swing.GroupLayout(painelP1);
        painelP1.setLayout(painelP1Layout);
        painelP1Layout.setHorizontalGroup(
            painelP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelP1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lbLogoP1)
                    .addComponent(lbNumProcessP1)
                    .addComponent(lbP1))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        painelP1Layout.setVerticalGroup(
            painelP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelP1Layout.createSequentialGroup()
                .addComponent(lbP1)
                .addComponent(lbLogoP1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbNumProcessP1))
        );

        painelP2.setBackground(new java.awt.Color(102, 102, 102));
        painelP2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 5, true));

        lbLogoP2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/CPU2_64x64.png"))); // NOI18N

        lbP2.setFont(new java.awt.Font("Tahoma", 1, 13));
        lbP2.setText("P2");

        lbNumProcessP2.setText("Processo n°: ---");

        javax.swing.GroupLayout painelP2Layout = new javax.swing.GroupLayout(painelP2);
        painelP2.setLayout(painelP2Layout);
        painelP2Layout.setHorizontalGroup(
            painelP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelP2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lbLogoP2)
                    .addComponent(lbNumProcessP2)
                    .addComponent(lbP2))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        painelP2Layout.setVerticalGroup(
            painelP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelP2Layout.createSequentialGroup()
                .addComponent(lbP2)
                .addComponent(lbLogoP2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbNumProcessP2))
        );

        javax.swing.GroupLayout painelCPUMP1Layout = new javax.swing.GroupLayout(painelCPUMP1);
        painelCPUMP1.setLayout(painelCPUMP1Layout);
        painelCPUMP1Layout.setHorizontalGroup(
            painelCPUMP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelCPUMP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                .addGroup(painelCPUMP1Layout.createSequentialGroup()
                    .addComponent(painelP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(painelP2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lbMP1))
        );
        painelCPUMP1Layout.setVerticalGroup(
            painelCPUMP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelCPUMP1Layout.createSequentialGroup()
                .addComponent(lbMP1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(painelCPUMP1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(painelP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(painelP2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        painelCPUMP2.setBorder(javax.swing.BorderFactory.createTitledBorder("Conjunto 2"));

        mp2.setEditable(false);
        jScrollPane2.setViewportView(mp2);

        lbMP2.setFont(new java.awt.Font("Tahoma", 1, 11));
        lbMP2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/mp_32x32.png"))); // NOI18N
        lbMP2.setText("MP2");

        painelP3.setBackground(new java.awt.Color(102, 102, 102));
        painelP3.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 5, true));
        painelP3.setMaximumSize(new java.awt.Dimension(100, 100));

        lbLogoP3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/CPU2_64x64.png"))); // NOI18N

        lbP3.setFont(new java.awt.Font("Tahoma", 1, 13));
        lbP3.setText("P3");

        lbNumProcessP3.setText("Processo n°: ---");

        javax.swing.GroupLayout painelP3Layout = new javax.swing.GroupLayout(painelP3);
        painelP3.setLayout(painelP3Layout);
        painelP3Layout.setHorizontalGroup(
            painelP3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelP3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelP3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lbLogoP3)
                    .addComponent(lbNumProcessP3)
                    .addComponent(lbP3))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        painelP3Layout.setVerticalGroup(
            painelP3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelP3Layout.createSequentialGroup()
                .addComponent(lbP3)
                .addComponent(lbLogoP3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbNumProcessP3))
        );

        painelP4.setBackground(new java.awt.Color(102, 102, 102));
        painelP4.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 5, true));

        lbLogoP4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/CPU2_64x64.png"))); // NOI18N

        lbP4.setFont(new java.awt.Font("Tahoma", 1, 13));
        lbP4.setText("P4");

        lbNumProcessP4.setText("Processo n°: ---");

        javax.swing.GroupLayout painelP4Layout = new javax.swing.GroupLayout(painelP4);
        painelP4.setLayout(painelP4Layout);
        painelP4Layout.setHorizontalGroup(
            painelP4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelP4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelP4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lbLogoP4)
                    .addComponent(lbNumProcessP4)
                    .addComponent(lbP4))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        painelP4Layout.setVerticalGroup(
            painelP4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelP4Layout.createSequentialGroup()
                .addComponent(lbP4)
                .addComponent(lbLogoP4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbNumProcessP4))
        );

        javax.swing.GroupLayout painelCPUMP2Layout = new javax.swing.GroupLayout(painelCPUMP2);
        painelCPUMP2.setLayout(painelCPUMP2Layout);
        painelCPUMP2Layout.setHorizontalGroup(
            painelCPUMP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelCPUMP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                .addGroup(painelCPUMP2Layout.createSequentialGroup()
                    .addComponent(painelP3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(painelP4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lbMP2))
        );
        painelCPUMP2Layout.setVerticalGroup(
            painelCPUMP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelCPUMP2Layout.createSequentialGroup()
                .addComponent(lbMP2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addGroup(painelCPUMP2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(painelP3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(painelP4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        bCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/Stop-icon_32.png"))); // NOI18N
        bCancelar.setText("Cancelar");
        bCancelar.setDefaultCapable(false);
        bCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bCancelarActionPerformed(evt);
            }
        });

        bExecutar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/Play-icon_32.png"))); // NOI18N
        bExecutar.setText("Executar");

        bPausa.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/Pause-icon_32.png"))); // NOI18N
        bPausa.setText("Pausa");

        painelRecursos.setBorder(javax.swing.BorderFactory.createTitledBorder("Recursos Adicionais"));

        lbImpressora1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/impressora2_64x64.png"))); // NOI18N

        lbImpressora2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/impressora2_64x64.png"))); // NOI18N

        lbScanner.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/scanner2_64x64.png"))); // NOI18N

        lbModem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/modem_64x64.png"))); // NOI18N

        lbDriveCD1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/driveCD_64x64.png"))); // NOI18N

        lbDriveCD2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/view/driveCD_64x64.png"))); // NOI18N

        javax.swing.GroupLayout painelRecursosLayout = new javax.swing.GroupLayout(painelRecursos);
        painelRecursos.setLayout(painelRecursosLayout);
        painelRecursosLayout.setHorizontalGroup(
            painelRecursosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelRecursosLayout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(lbImpressora1)
                .addGap(18, 18, 18)
                .addComponent(lbImpressora2)
                .addGap(18, 18, 18)
                .addComponent(lbScanner)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
                .addComponent(lbModem)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbDriveCD1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lbDriveCD2)
                .addGap(8, 8, 8))
        );
        painelRecursosLayout.setVerticalGroup(
            painelRecursosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelRecursosLayout.createSequentialGroup()
                .addGroup(painelRecursosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbImpressora2)
                    .addComponent(lbImpressora1)
                    .addComponent(lbScanner)
                    .addComponent(lbModem)
                    .addComponent(lbDriveCD1)
                    .addComponent(lbDriveCD2))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        painelFilas.setBorder(javax.swing.BorderFactory.createTitledBorder("Filas de Processos Prontos"));

        filaTempoReal.setBackground(new java.awt.Color(255, 255, 255));
        filaTempoReal.setEditable(false);
        filaTempoReal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                filaTempoRealActionPerformed(evt);
            }
        });

        filaUsuario1.setBackground(new java.awt.Color(255, 255, 255));
        filaUsuario1.setEditable(false);
        filaUsuario1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                filaUsuario1ActionPerformed(evt);
            }
        });

        filaUsuario2.setBackground(new java.awt.Color(255, 255, 255));
        filaUsuario2.setEditable(false);
        filaUsuario2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                filaUsuario2ActionPerformed(evt);
            }
        });

        filaUsuario3.setBackground(new java.awt.Color(255, 255, 255));
        filaUsuario3.setEditable(false);
        filaUsuario3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                filaUsuario3ActionPerformed(evt);
            }
        });

        lbTempoReal.setText("Tempo-Real:");

        lbUsuario1.setText("Usuário 1:");

        lbUsuario2.setText("Usuário 2:");

        lbUsuario3.setText("Usuário 3:");

        javax.swing.GroupLayout painelFilasLayout = new javax.swing.GroupLayout(painelFilas);
        painelFilas.setLayout(painelFilasLayout);
        painelFilasLayout.setHorizontalGroup(
            painelFilasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelFilasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelFilasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbTempoReal, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lbUsuario1, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lbUsuario2, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lbUsuario3, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGap(14, 14, 14)
                .addGroup(painelFilasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(filaTempoReal, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE)
                    .addComponent(filaUsuario1, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE)
                    .addComponent(filaUsuario2, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE)
                    .addComponent(filaUsuario3, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE))
                .addContainerGap())
        );
        painelFilasLayout.setVerticalGroup(
            painelFilasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelFilasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelFilasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbTempoReal)
                    .addComponent(filaTempoReal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelFilasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lbUsuario1)
                    .addComponent(filaUsuario1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelFilasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(filaUsuario2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbUsuario2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelFilasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(filaUsuario3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbUsuario3))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        painelFilaEntrada.setBorder(javax.swing.BorderFactory.createTitledBorder("Fila de Entrada"));

        filaEntrada.setEditable(false);
        filaEntrada.setFont(new java.awt.Font("Tahoma", 1, 12));
        jScrollPane4.setViewportView(filaEntrada);

        javax.swing.GroupLayout painelFilaEntradaLayout = new javax.swing.GroupLayout(painelFilaEntrada);
        painelFilaEntrada.setLayout(painelFilaEntradaLayout);
        painelFilaEntradaLayout.setHorizontalGroup(
            painelFilaEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
        );
        painelFilaEntradaLayout.setVerticalGroup(
            painelFilaEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
        );

        painelContador.setBorder(javax.swing.BorderFactory.createTitledBorder("Temporizador"));

        temporizador.setEditable(false);
        temporizador.setFont(new java.awt.Font("Tahoma", 1, 24));
        temporizador.setForeground(new java.awt.Color(0, 51, 255));
        temporizador.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        temporizador.setText("0");
        temporizador.setBorder(null);
        temporizador.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                temporizadorActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout painelContadorLayout = new javax.swing.GroupLayout(painelContador);
        painelContador.setLayout(painelContadorLayout);
        painelContadorLayout.setHorizontalGroup(
            painelContadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(temporizador, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)
        );
        painelContadorLayout.setVerticalGroup(
            painelContadorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(temporizador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        javax.swing.GroupLayout painelPrincipalLayout = new javax.swing.GroupLayout(painelPrincipal);
        painelPrincipal.setLayout(painelPrincipalLayout);
        painelPrincipalLayout.setHorizontalGroup(
            painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelPrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelPrincipalLayout.createSequentialGroup()
                        .addComponent(bCancelar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(bPausa)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(bExecutar))
                    .addGroup(painelPrincipalLayout.createSequentialGroup()
                        .addGroup(painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, painelPrincipalLayout.createSequentialGroup()
                                .addComponent(painelFilaEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(painelContador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(24, 24, 24))
                            .addComponent(painelFilas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(painelRecursos, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(painelPrincipalLayout.createSequentialGroup()
                                .addComponent(painelCPUMP1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(painelCPUMP2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(10, 10, 10))
        );
        painelPrincipalLayout.setVerticalGroup(
            painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelPrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelPrincipalLayout.createSequentialGroup()
                        .addGroup(painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(painelFilaEntrada, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(painelContador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(painelFilas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(painelCPUMP1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(painelCPUMP2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(painelRecursos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(painelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bExecutar)
                    .addComponent(bPausa)
                    .addComponent(bCancelar))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(painelPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(painelPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void bCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bCancelarActionPerformed
        new JanelaPrincipal().setVisible(true);
        dispose();
    }//GEN-LAST:event_bCancelarActionPerformed

    private void filaTempoRealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filaTempoRealActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_filaTempoRealActionPerformed

    private void filaUsuario1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filaUsuario1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_filaUsuario1ActionPerformed

    private void filaUsuario2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filaUsuario2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_filaUsuario2ActionPerformed

    private void filaUsuario3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filaUsuario3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_filaUsuario3ActionPerformed

    private void temporizadorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_temporizadorActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_temporizadorActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new JanelaEscalonador().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bCancelar;
    private javax.swing.JButton bExecutar;
    private javax.swing.JButton bPausa;
    private javax.swing.JTextPane filaEntrada;
    private javax.swing.JTextField filaTempoReal;
    private javax.swing.JTextField filaUsuario1;
    private javax.swing.JTextField filaUsuario2;
    private javax.swing.JTextField filaUsuario3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JLabel lbDriveCD1;
    private javax.swing.JLabel lbDriveCD2;
    private javax.swing.JLabel lbImpressora1;
    private javax.swing.JLabel lbImpressora2;
    private javax.swing.JLabel lbLogoP1;
    private javax.swing.JLabel lbLogoP2;
    private javax.swing.JLabel lbLogoP3;
    private javax.swing.JLabel lbLogoP4;
    private javax.swing.JLabel lbMP1;
    private javax.swing.JLabel lbMP2;
    private javax.swing.JLabel lbModem;
    private javax.swing.JLabel lbNumProcessP1;
    private javax.swing.JLabel lbNumProcessP2;
    private javax.swing.JLabel lbNumProcessP3;
    private javax.swing.JLabel lbNumProcessP4;
    private javax.swing.JLabel lbP1;
    private javax.swing.JLabel lbP2;
    private javax.swing.JLabel lbP3;
    private javax.swing.JLabel lbP4;
    private javax.swing.JLabel lbScanner;
    private javax.swing.JLabel lbTempoReal;
    private javax.swing.JLabel lbUsuario1;
    private javax.swing.JLabel lbUsuario2;
    private javax.swing.JLabel lbUsuario3;
    private javax.swing.JTextPane mp1;
    private javax.swing.JTextPane mp2;
    private javax.swing.JPanel painelCPUMP1;
    private javax.swing.JPanel painelCPUMP2;
    private javax.swing.JPanel painelContador;
    private javax.swing.JPanel painelFilaEntrada;
    private javax.swing.JPanel painelFilas;
    private javax.swing.JPanel painelP1;
    private javax.swing.JPanel painelP2;
    private javax.swing.JPanel painelP3;
    private javax.swing.JPanel painelP4;
    private javax.swing.JPanel painelPrincipal;
    private javax.swing.JPanel painelRecursos;
    private javax.swing.JTextField temporizador;
    // End of variables declaration//GEN-END:variables
}
